import java.awt.event.*;
import javax.swing.*;
public class ListenNumber implements ActionListener { 
   RandomNumber randomNumber;
   JTextField inputGuess;  
   JTextField hintText;  
   public void setRandomNumber(RandomNumber randomNumber) {
      this.randomNumber=randomNumber;
   }
   public void setHintJTextField(JTextField t){
      hintText=t; 
   }
   public void setInputJTextField(JTextField t){
      inputGuess=t; 
   }
   public void actionPerformed(ActionEvent e) {
      int n=(int)(Math.random()*100)+1;
      randomNumber.setNumber(n);
      hintText.setText("输入你的猜测：");
      inputGuess.setText(null);
   }
}


   